/**
 * 
 */
package jfengao.oauth.client.common;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * @author gaofeng
 * @date 2018年9月17日
 */
public class IO {

	public IO() {
	}

	public static byte[] readFromInputStream(InputStream ins) throws IOException {
		byte buffer[] = new byte[16];
		BufferedInputStream bis = new BufferedInputStream(ins);
		int len = -1;
		ByteArrayOutputStream bos = new ByteArrayOutputStream();
		while ((len = bis.read(buffer)) != -1) {
			bos.write(buffer, 0, len);
		}
		return bos.toByteArray();
	}
}

